package io.sage.modules.basics.service.impl;

import io.sage.modules.basics.entity.BLocationPosition;
import io.sage.modules.basics.dao.BLocationPositionMapper;
import io.sage.modules.basics.service.BLocationPositionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (BLocationPosition)表服务实现类
 *
 * @author zxh
 * @since 2019-08-10 10:50:13
 */
@Service("bLocationPositionService")
public class BLocationPositionServiceImpl implements BLocationPositionService {
    @Resource
    private BLocationPositionMapper bLocationPositionMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public BLocationPosition queryById(Integer id) {
        return this.bLocationPositionMapper.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<BLocationPosition> queryAllByLimit(int offset, int limit) {
        return this.bLocationPositionMapper.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param bLocationPosition 实例对象
     * @return 实例对象
     */
    @Override
    public BLocationPosition insert(BLocationPosition bLocationPosition) {
        this.bLocationPositionMapper.insert(bLocationPosition);
        return bLocationPosition;
    }

    /**
     * 修改数据
     *
     * @param bLocationPosition 实例对象
     * @return 实例对象
     */
    @Override
    public BLocationPosition update(BLocationPosition bLocationPosition) {
        this.bLocationPositionMapper.update(bLocationPosition);
        return this.queryById(bLocationPosition.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.bLocationPositionMapper.deleteById(id) > 0;
    }

    @Override
    public List<BLocationPosition> queryAll(BLocationPosition bLocationPosition) {
        return this.bLocationPositionMapper.queryAll(bLocationPosition);
    }
}